<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
   <script src="./vue.js"></script>

   <style>

   </style>
</head>

<body>
    <div class="app">
        <h2>货币换算</h2>
    ￥: <input type="text" v-model.Number="rmb">
    <br>
     $: <input type="text" v-model="meiyuan">
    <br>
    {{rmb}}人民币 = {{meiyuan}}美元
  </div>
  <script>
     Vue.config.productionTIp=false//阻止vue在启动时生成产生提示
    const vm = new Vue({
      el: ".app",
      data: { 
          meiyuan: "",
          rmb: ""
      },
      watch: {
        rmb(newV, oldV) {
          this.meiyuan = (newV / 6.7981)
        },
        meiyuan(newV, oldV) {
          this.rmb = (newV * 6.7981)
        }
      }
    })
  </script>
</body>

</html> 